// 导入自己封装的已经连接的mongoose
const mongoose = require('./connect')

// 商品表的schema
const dishSchema = new mongoose.Schema({
    name: {
        required: true,
        type: String
    },
    price: {
        required: true,
        type: Number
    },
    imgpath: {
        required: true,
        type: String
    },
    specifications: String,
    kind: String,
    enable: Boolean,
    catname: String,
    detail: String,
})

const dishModel = mongoose.model('dish', dishSchema, 'dish')


// 导出model
module.exports = dishModel